package com.codeoss.framework.db.table.store;

import org.springframework.beans.BeansException;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.stereotype.Service;

import com.codeoss.framework.db.table.ITableService;

@Service
public class TableServiceStore implements ITableServiceStore,ApplicationContextAware{
    private ApplicationContext applicationContext;
    @Value("${framework.db-type}")
	private String dbType;
	@Override
	public ITableService getTableService() {
		// TODO Auto-generated method stub
		ITableService tableService=(ITableService)applicationContext.getBean(dbType+"TableService");
		return tableService;
	}

	@Override
	public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
		// TODO Auto-generated method stub
		this.applicationContext=applicationContext;
	}

}
